<%--

  Licensed under the GNU LESSER GENERAL PUBLIC LICENSE, version 2.1, dated February 1999.

  This program is free software; you can redistribute it and/or modify
  it under the terms of the latest version of the GNU Lesser General
  Public License as published by the Free Software Foundation;

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public License
  along with this program (LICENSE.txt); if not, write to the Free Software
  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

--%>
<%@ page errorPage="/WEB-INF/jsp/error.jsp"
    contentType="text/html; charset=utf-8"
%>

<%@ include file="page-init.jsp" %>
<%@ page import="org.jamwiki.model.*,org.jamwiki.utils.*" %>
 
     <table width="100%" border="0" cellspacing="0" cellpadding="0">
         <tr>
           <td width="0" class="word-orange" align="center"><%@ include file="navigation-menu.jsp" %></td>   
           </tr>  
      </table>
     <table width="98%" height="8" border="0" cellpadding="0" cellspacing="0">
       <tr>
         <td><%@ include file="top-menu.jsp" %></td>
       </tr>
     </table>
     <table width="98%"><tr><td>
		 <div align="left">
			<c:if test="${!empty editResolve}">
			<div class="message red"><f:message key="edit.exception.conflict" /></div>
			</c:if>
			
			<c:if test="${!empty topicVersionId}"><div class="message red"><f:message key="edit.warning.oldversion" /></div></c:if>
			
			<c:if test="${!empty editSpam}">
			<div class="message red"><f:message key="${spam.key}"><f:param value="${spam.params[0]}" /></f:message></div>
			</c:if>
			<jamwiki:enabled property="PROP_TOPIC_USE_PREVIEW">
			<c:if test="${!empty editPreview}">
			<div class="message red"><f:message key="edit.warning.preview" /></div>
			</c:if>
			</jamwiki:enabled>
			
			<%@ include file="category-include.jsp" %>
			
			<jamwiki:enabled property="PROP_TOPIC_USE_PREVIEW">
			<c:if test="${!empty editPreview}">
			<%@ include file="view-topic.jsp" %>
			</c:if>
			</jamwiki:enabled>
			<fieldset>
			<legend><f:message key="topic.caption.editlegend" /></legend>
			
			<form name="form" method="post" name="editform" action="<jamwiki:link value="Special:Edit" />">
			<input type="hidden" name="topic" value="<c:out value="${pageInfo.topicName}"/>" />
			<input type="hidden" name="lastTopicVersionId" value="<c:out value="${lastTopicVersionId}"/>" />
			<input type="hidden" name="section" value="<c:out value="${section}"/>" />
			<input type="hidden" name="topicVersionId" value="<c:out value="${topicVersionId}"/>" />
			<%--
			/**add by shangchm 20080702*/
			--%>
			<input type="hidden" name="categoryId" value="<c:out value="${categoryId}"/>" />
			
			<jamwiki:enabled property="PROP_TOPIC_WYSIWYG">
			
			<script type="text/javascript">
			/*<![CDATA[*/
			document.writeln("<div id='toolbar'>");
			addButton('/jamwiki/images/button_bold.png','<f:message key="edit.button.bold"/>','\'\'\'','\'\'\'','<f:message key="edit.button.bold.text"/>');
			addButton('/jamwiki/images/button_italic.png','<f:message key="edit.button.italic"/>','\'\'','\'\'','<f:message key="edit.button.italic.text"/>');
			addButton('/jamwiki/images/button_underline.png','<f:message key="edit.button.underline"/>','<u>','</u>','<f:message key="edit.button.underline.text"/>');
			addButton('/jamwiki/images/button_link.png','<f:message key="edit.button.internal.link"/>','[[',']]','<f:message key="edit.button.internal.link.text"/>');
			addButton('/jamwiki/images/button_extlink.png','<f:message key="edit.button.external.link"/>','[',']','<f:message key="edit.button.external.link.text"/>');
			addButton('/jamwiki/images/button_headline.png','<f:message key="edit.button.head2"/>','\n== ',' ==\n','<f:message key="edit.button.head2.text"/>');
			addButton('/jamwiki/images/button_image.png','<f:message key="edit.button.image"/>','[[Image:',']]','<f:message key="edit.button.image.text"/>');
			addButton('/jamwiki/images/button_nowiki.png','<f:message key="edit.button.nowiki"/>','<nowiki>','</nowiki>','<f:message key="edit.button.nowiki.text"/>');
			addButton('/jamwiki/images/button_sig.png','<f:message key="edit.button.signature"/>','--~~~~','','');
			addButton('/jamwiki/images/button_hr.png','<f:message key="edit.button.line"/>','\n----\n','','');
			document.writeln("</div>");
			/*]]>*/ 
			</script>
			</jamwiki:enabled>
			
			<p>
			<textarea name="contents" rows="25" cols="80" accesskey=","><c:out value="${contents}" escapeXml="true" /></textarea>
			</p>
			<p  style="display: none"><label for="editComment"><f:message key="edit.caption.comment" /></label>: <input type="text" name="editComment" value="<c:out value="${editComment}" />" size="60" id="editComment" /></p>
			<p>
			<input type="submit" name="save" value="<f:message key="common.save"/>"  accesskey="s"/>
			
			<jamwiki:enabled property="PROP_TOPIC_USE_PREVIEW"><input style="display: none" type="submit" name="preview" value="<f:message key="edit.action.preview"/>" accesskey="p"/></jamwiki:enabled>
			
			&nbsp;&nbsp;&nbsp;
			<input type="hidden" value="<c:if test="${minorEdit}">true</c:if>" name="minorEdit" id="minorEdit" accesskey="i" />
			
			<authz:authorize ifAllGranted="ROLE_USER">
			<input style="display:none" type="checkbox" value="true" name="noticeTopic"<c:if test="${noticeTopic}"> checked</c:if> id="noticeTopic" accesskey="n" />
			<label style="display:none"  for="minorEdit">公告</label>
			&nbsp;&nbsp;&nbsp;
			<input type="checkbox" value="true" name="watchTopic"<c:if test="${watchTopic}"> checked</c:if> id="watchTopic" accesskey="w" />
			<label for="watchTopic"><f:message key="edit.caption.watch" /></label>
			</authz:authorize>
			</p>
			
			<c:if test="${!empty editResolve}">
			<%@ include file="diff-include-others.jsp" %>
			<p>
			<textarea name="contentsResolve" rows="50" cols="80"><c:out value="${contentsResolve}" escapeXml="true" /></textarea>
			</p>
			</c:if>
			
			</form>
			
			</fieldset>
			</div>
		</td></tr></table>

